package com.graduation.rescuematerial.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.graduation.rescuematerial.pojo.CompanyMaterial;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author CaiShuanglian
 * @since 2022-05-08
 */
@Mapper
public interface CompanyMaterialMapper extends BaseMapper<CompanyMaterial> {

    //减库存
    int reduceStock(@Param("companyName") String companyName, @Param("materialId") Integer materialId, @Param("number") Integer number);

    //加库存
    int addStock(@Param("companyName") String companyName, @Param("materialId") Integer materialId, @Param("number") Integer number);

    //获取数据
    CompanyMaterial getByCompanyNameAndMaterialId(@Param("companyName") String companyName, @Param("materialId") Integer materialId);

    //增加一条数据
    int addOne(CompanyMaterial companyMaterial);

    int updateMaterial(@Param("materialId") Integer materialId, @Param("number") Integer number, @Param("status") Boolean status, @Param("companyName") String companyName);
}
